How to set a target as image [on hold]
Posted
by
Zadalaxmi
on Game Development
See other posts from Game Development
or by Zadalaxmi
Published on 2014-05-30T04:33:17Z
Indexed on
2014/05/30
9:39 UTC
Read the original article
Hit count: 514
collision-detection
|libgdx
How to set a target as image in given code.
public void addListenerForImage(final Image roomImage)
{
final DragAndDrop dragAndDrop = new DragAndDrop();
dragAndDrop.addSource(new DragAndDrop.Source(roomImage) {
public DragAndDrop.Payload dragStart (InputEvent event, float x, float y, int pointer) {
DragAndDrop.Payload payload = new DragAndDrop.Payload();
payload.setDragActor(roomImage);
dragAndDrop.setDragActorPosition(-x, -y + roomImage.getHeight());
return payload;
}
public void dragStop (InputEvent event, float x, float y, int pointer,Target target) {
roomImage.setBounds(50, 125, roomImage.getWidth(), roomImage.getHeight());
if(target != null) {
roomImage.setPosition(target.getActor().getX(), target.getActor().getY());
}
System.out.println(target);
stage.addActor(roomImage);
}
});
My problem is i can drag the images and i am not able to set target as image; and target shows as null;One more if a invisible some of the images in group how can i test that it is overlapped or not;Please give some links and suggestion
© Game Development or respective owner